Skip to main content

Full text of "Arduino"

See other formats

Kitty Twitty Cat Toy 


Make Projects 

build, hack, tweak, share, discover, J 

Kitty Twitty Cat Toy 

Written By: Marc de Vinck 


Binder clips (1) 

Drill (1) 

My LED holders and switch needed 5/8" 

holes; yours may vary. 

Eraser (1) 

Fume extractor (1) 
but highly recommended, for your 
respiratory health when soldering. To 
make your own, see MAKE Volume 19. 
page 123. 

MAKE: Warranty Voider Leather man 
"Squirt" E4 (1) 

#MKWVE4 from the Maker Shed. Or you 
can use standard cutting pliers and 
needlenose pliers. 

Paintbrushes (1) 

Pencil (1) 

Scissors (1) 

Screwdriver (1) 

Soldering iron (1) 


Arduino Duemilanove (1) 

item #MKSP4 from the Maker Shed 

(http.V/makershed. com) 

Arduino Ethernet Shield (1) 
Maker Shed #MKSP7 

Power supply (1) 

Maker Shed #MKSF3. Or use a 9V 
battery with a center-positive 
5.5mmx2. 1mm barrel connector, 
especially if your cat chews on wires. 

Enclosure (1) 

This can be almost anything, as long as 
the Arduino and Ethernet Shield fit 
inside. Also, since your cat will be 
playing with it. no glass or toxic paints, 
and the heavier the better. I used a $6 
wooden box from a local craft store. 

LEDs (2) 

Resistor (1) 

resistors (2) 

or other value matched to lighting your 

© Make Projects 

Page 1 of 1 6 

Kitty Twitty Cat Toy 

LEDs with 5V DC 

LED holders (2) 

Switch (1) 

/ used a sub-mini toggle, RadioShack 

part #275-0612. 

Ethernet cable (1) 


Solder (1) 

i • Heat-shrink tubing (1) 

Craft glue (1) 

Paint (1) 

Paper (1) 

Glue stick (1) 

Sealer (1) 

Guitar E string (1) 

Wall anchor (1) 

or similar, from a hardware store 

Computer (1) 

free download at 

USB A-B cabled) 

for programming the Arduino. Borrow 

one from your printer. 


About 2 months ago, after years of begging and pleading from my family, I reluctantly agreed 
to get another cat from the local shelter. We already have a menagerie of beasts that share 
our home, but for some reason they felt we needed another. 

I admit, I do like our new addition to the family. Chester is a spunky little stray who's always 
looking for fun. Even if it means knocking a few things off my desk as I write this article. The 

© Make Projects 

Page 2 of 1 6 

Kitty Twitty Cat Toy 

only problem is, when my wife goes in to work, she misses her new cat and always wants to 
know his whereabouts. 

She used to ask me for updates, but after a while I realized that I needed to make something 
that would take me out of the loop, and let the cat communicate with my wife directly via I needed a Twittering cat toy. And that's how Kitty Twitty came to fruition, after 
some basic soldering and crafting with just a few parts. 


• Chester doesn't get too aggressive with the Kitty Twitty, but if he ever does, I'll add some 
weight to the enclosure to help keep it upright. 

• Decide where to drill the hole for the power and Ethernet cables. Attach the Ethernet shield 
on top of the Arduino and place them in the box to see where they fit best. Mark the 
location of the hole with a pencil on the outside of the box 

• Use a V2" spade bit to drill the hole, and go slow to minimize splintering. Once the hole is 
drilled, give it a quick test-fit. Does it fit? Yes? Good! 

© Make Projects 

Page 3 of 1 6 

Kitty Twitty Cat Toy 


Mark the 4 holes where you want to mount the 2 LED holders, the power switch, and the 
hollow wall anchor. The wall anchor should be in the center. 

Drill small pilot holes at each location (1/8" should work) and then drill out the holes to fit 
the components. 

Test-fit the components, but don't permanently attach anything yet. 

• Decorate! I marked out my design in pencil and then painted it with kitty-safe nontoxic 
paint. Don't forget to paint the inside; you'll want to show your friends how it works, and 
having a painted inside looks so much cooler! 

• After the paint dries, attach the LED holders and the switch to their respective holes. A few 
nuts and washers, and it's done. 

• Finally, attach the hollow wall anchor. Screw it in slowly to avoid damaging the wood, and 
don't overtighten. The anchor will fold up on itself and its "legs" will secure it against the 
inside of the box, but they shouldn't dig into the surface. Once the anchor is in place, 
remove the screw. 

© Make Projects 

Page 4 of 1 6 

Kitty Twitty Cat Toy 

Cut the guitar string to about 10"— 12", keeping the lug end (with the little brass barrel). The 
lug will prevent the wire from being pulled out by an aggressive kitty. If you're using plain 
steel wire, tie a knot instead. 

Use small pliers to curl the cut end around, so it will attach to the toy more easily and 
won't expose the cat to being poked with a sharp wire. 

To electrically insulate the guitar wire from the wall anchor, cut two 1 /2"-long pieces of 1/8" 
heat-shrink tubing, then slip and shrink them one by one over the wire at the lug end. 

© Make Projects 

Page 5 of 1 6 

Kitty Twitty Cat Toy 

Solder a 6" length of insulated solid-core wire (I chose red) to the brass lug grommet, 
extended away from the guitar string, and encase the entire connection in another piece of 

Thread the guitar string through the underside of the hollow wall anchor and screw in the 
wad of heat-shrink. It's OK if it's a tight fit; my heat-shrink even twisted a bit, which made 
for a nice fit. But make sure the wires and lug do not make any metal-to-metal contact with 
the anchor. 

While keeping the guitar string centered (I used a "third hand" but you could have a friend 
hold it steady), apply some hot glue into the core of the hollow wall anchor around the 
string. You don't want to fill the entire cavity, just a bit around the bottom to further insulate 
the guitar string and keep it straight and secure. 

If you add too much hot glue, the wire won't be able to flex enough to touch the top of the 
anchor, so err on the side of caution and use only a dab or two. 

© Make Projects 

Page 6 of 1 6 

Kitty Twitty Cat Toy 

• Feed the Ethernet and power cables through the hole you drilled in Step 1 . Tie a simple 
knot to keep them from being pulled out of the box. Position the Arduino boards in the box, 
plug in both cables, and also plug the red wire from the guitar string into its 5V header 

• On the lid of the box, solder a 3"-4" piece of wire to one of the anchor's legs. Using a 
different color wire (purple here) will help. The anchor draws a lot of heat away, so you'll 
need to heat it with the soldering iron for a while, or else the solder will bead up and you 
won't get a good joint. 

• Now we'll split the connection from the hollow wall anchor so that one wire goes to an 
Arduino ground pin (GND) through a 10kQ resistor, and the other wire connects to its 
digital I/O pin 6. Doing this pulls pin 6 to ground, so that it reads LOW unless contact is 
made by the sensor. 

• Strip, twist, and solder a wire to the end of the anchor wire, along with one end of the pull- 
down resistor. Then solder a third wire to the other end of the resistor, and insulate the 
entire junction with a long piece of heat-shrink. Make sure you can identify which lead runs 
to the resistor and which goes directly to the anchor. 

© Make Projects 

Page 7 of 1 6 

Kitty Twitty Cat Toy 

Unplug the power supply cord at both ends, and then cut and strip one of its wires about 2" 
from the barrel plug end. 

Solder a piece of wire to each end of the cut wire, and seal both connections with some 
heat-shrink tubing. 

Electrical tape will work too, but I find that using heat-shrink makes for a more 
permanent solution. 

Solder the free ends of the wires you just attached to the 2 terminals of your switch. No 
need to worry about the polarity; either way works. 

© Make Projects 

Page 8 of 1 6 

Kitty Twitty Cat Toy 

If you're using LED holders, remove their rubber grommets and insert an LED into each. 
Make sure you know which color LED is which. 

If your LED is clear, you can verify its color by pressing its leads around a 3V coin- 
cell battery (CR2032), longer lead on the positive (+) side of the battery and shorter 
on the negative (-). 

For each LED, solder a 220Q resistor (or similar value) between the positive (longer) lead 
and a 3"-4" length of wire. The resistor limits the amount of current that flows through the 
LED, so that it won't burn out. Solder a 3"-4" wire of a different color to each negative lead. 
I used yellow for positive and blue for negative, but red and black are traditional. 

If your enclosure is shallow, you may need to trim the LED leads before soldering 
so that the lid will close. Cut them at an angle to retain the different lengths that 
indicate (+/-) polarity. 

Insulate all connections with heat-shrink tubing (I used clear heat-shrink here) or electrical 

© Make Projects 

Page 9 of 1 6 

Kitty Twitty Cat Toy 

Fit the LEDs into their holders. Plug their negative leads into 2 ground (GND) header pins 
on the Arduino. Plug the positive lead of the blue LED into digital pin 8 of the Arduino and 
the positive lead of the green LED into pin 9. 

To wire the split lead from the wall anchor, plug the lead without the resistor into Arduino 
digital pin 6, and the resistor lead into ground. All done! 

© Make Projects 

Page 10 of 16 

Kitty Twitty Cat Toy 

Step 10 — Make the paper toy- 

Kitty-wise, the most important part of this build is the actual toy that the cat plays with. 
You can use almost anything, from a feather or piece of cardboard to a lightweight 
manufactured toy. Just make sure the materials are 100% kitty friendly. And you can 
enhance your kitty's fun by adding some catnip! 

Draw a bird, or whatever you think might interest your kitty, onto a piece of paper. Once 
you have your final design, tape 2 pieces of paper together and cut the design out of both, 
to make 2 mirror images. I decided to add a few white paper highlights, and you could 
easily add additional detail with nontoxic markers. 

Add plenty of nontoxic glue to one side of a paper bird. Center the guitar wire loop in the 
middle, and then add the other bird cutout to the opposite side to create a paper-wi re- paper 
birdie sandwich. 

Press the birdie between books or in binder clips while the glue dries. I decided to clip it 
and let it sit overnight. The end result was a durable and appealing birdie for my cat to 

Download these papercraft bird costumes for your Kitty Twitty. 

© Make Projects 

Page 11 of 16 

Kitty Twitty Cat Toy 

Step 11 — Set up the software 

• Sign up for a new Twitter account, 
following the instructions to create 
a username and password. It's 
simple and free! 

• Download and install the Arduino 
software . 

• Download and install NeoCat's 
Twitter Library for Arduino , which 
makes it easy for the code to 
connect to Twitter. 

• Download and install Tom Igoe's 
String library (formerly TextString), 
which simplifies the code to 
assemble random sentences. 

• Download the Kitty Twitty source 
code . Open the file in the Arduino 
application and find the line of code 
near the top of the program that 
looks like this: 

• Twitter 

twitter ( "user : password" ) ; 
// replace the 
"user : password" with 

• As the comment directs, replace 
"user:password" with the username 
and password you created with 
your new Twitter account. Keep the 
quotation marks, and don't forget 
the colon (:) in between! 

© Make Projects 

Page 12 of 16 

Kitty Twitty Cat Toy 

© Make Projects Page 1 3 of 1 6 

Kitty Twitty Cat Toy 

• To configure the network 
information in the code, find this 
section of code and replace the 

ip, gateway, and subnet values 

with your own values. 

• byte ip[ ] = { 192, 168, 
2, 7 } ; //a free IP 
address on your network 

• byte gateway [ ] = { 192, 
168, 2, 1 }; // the 
gateway address of your 

• byte subnet [] = { 255, 
255, 255, } ; // the 
subnet mask of your 

• To get these settings, start by 
looking at your computer's network 
settings. On a Mac, go to System 
Preferences/Network, then click 
the Advanced button and select the 
TCP/IP tab. On a PC, goto 
Start/Control Panel/Network and 
Sharing Center, then click View 
Status and Details. For the code's 
free IP address, you can usually 
just take your network setting and 
increase the last number a little bit. 
In my case, my computer's 
address is 192 . 168 . 2 . 6, so I 
tried 192 . 168 .2.12 and it worked 

• Next is the gateway address. On a 
Mac, this is listed as Router and on 

© Make Projects 

Page 14 of 16 

Kitty Twitty Cat Toy 

a PC, it's listed as Default 
Gateway. Mine is 192 . 168 .2.1. 

The subnet mask is generally 

255 . 255 . 255 . 0, but yours may 

be different, and it will also be 
listed in with your computer's 
network config information. 

Save the revised code, then upload 
it to your Arduino. With the Arduino 
environment already configured to 
recognize your port and board, this 
usually means just plugging it into 
your computer and clicking the 
Upload button. But if you're not 
sure how to do this, the Arduino 
website has great tutorials, and the 
Resources section on the next 
page lists other ways to get 

If you have trouble with any of the 
software setup, try posting in the 
MAKE forums . They're filled with 
friendly and helpful people. 


This is really easy. Simply plug in the power supply and Ethernet cable, and flip the switch. The 
green power LED should come on, and in a few seconds, the blue network status LED, too. The 
code tweets an "Up and Running" message to let you know everything is OK. You can plug a 
USB cable into the Arduino and listen in on the serial port for some debugging. 

Every time the wire makes a connection, you'll see a new tweet! That's it! 

You can modify this project to make almost anything send a tweet. It's a cat toy, but there's no 
reason it can't be converted into a Twittering dog toy, or even a Twittering bird perch. Just 

© Make Projects Page 1 5 of 1 6 

Kitty Twitty Cat Toy 

substitute a different kind of switch sensor for the bird-on-a-wire. Make a Twittering burglar 
alarm? Easy! Doggie door? Sure! Twittering fish? Now that's a challenge! 

Also, you can add additional switches or sensors, connect them to as-yet-unused pins on the 
Arduino, and write some code to handle them. Think about adding a servo to make some random 
rumbles, or a speaker to simulate a bird. That should keep your cat's interest! 

This project is still evolving, and I need to add more parts and experiment with them before I 
settle on the final Twittering toy. By the time you read this, I hope to have modifications that 
check whether your cat is sleeping or needs food, via pressure-sensitive piezos under its bed 
and food bowl. I also plan to add a speaker or small motor to get the cat's attention. See to learn more about these modifications. 


Kitty Twitty project code, links, and other resources: 

Arduino tutorials: 

Getting Started with Arduino by Massimo Banzi: Maker Shed item #9780596155513, 

Making Things Talk by Tom Igoe: Maker Shed item #0596510519 

This project first appeared in MAKE Volume 22 . page 80. 

This document was last generated on 201 2-1 1 -03 03:1 7:1 4 AM. 

© Make Projects Page 1 6 of 1 6